<template>
  <div class="toast"
       v-show="isShow">
    <div v-if="type === 'tip'|| type === 'violations'"
         class="mask"
         @touchmove.prevent.stop></div>
    <div :class="['toast_info',type === 'error'?'error':'',type === 'loading'?'loading':'',type === 'tip'?'tip':'']">
      <div class="loading-icon"
           v-show="type === 'loading'">
        <img src="">
      </div>
      <i class="icon icon-success"
         v-show="type === 'success'"></i>
      <i class="icon icon-error"
         v-show="type === 'error'"></i>
      <p class="text-content"
         v-if="text"
         v-html="text"></p>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    isShow: {
      default: false
    },
    text: {
      default: ''
    },
    infoShow: {
      default: true
    },
    time: {
      default: 0
    },
    type: {
      default: 'loading'
    }
  },
  data: () => ({})
}
</script>
<style scoped>
.toast {
  z-index: 1000;
}
.mask {
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 1);
}
.toast_info {
  position: fixed;
  z-index: 2000;
  padding: 10px;
  width: 256px;
  min-height: 256px;
  /*min-height: 100px;*/
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  background: rgba(3, 16, 42, 0.6);
  line-height: 40px;
  font-size: 28px;
  color: #fff;
  box-sizing: border-box;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.toast_info.loading {
  width: 120px;
  height: 120px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}
.toast_info.tip {
  /* width: 700px; */
  /* width: auto; */
  width: 256px;
  height: 256px;
  border-radius: 16px;
  background: rgba(3, 16, 42, 0.4);
  line-height: 40px;
  font-size: 28px;
  color: #fff;
}
.toast_info i {
  width: 40px;
  height: 40px;
  margin-bottom: 20px;
  background: url('https://s.kcimg.cn/topic/images/38-carsisterinlaw/success-icon.png');
  background-size: 40px 40px;
}
.toast_info.error i {
  margin: 36px auto 20px;
  width: 88px;
  height: 88px;
  background: url('https://s-test.kcimg.cn/m/images/bbs/coupon/icon.png');
  background-size: 88px 88px;
}
.toast p {
  color: #fff;
  font-size: 28px;
  letter-spacing: 0;
  text-align: center;
  line-height: 40px;
  width: 100%;
  word-break: break-all;
}
.toast_info.loading p,
.toast_info.tip p {
  font-size: 40px;
  line-height: 56px;
  color: #fff;
}
.loading-icon {
  margin-bottom: 16px;
  width: 32px;
  height: 32px;
  background: transparent;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from {
    transform: rotate(0);
  }
  to {
    transform: rotate(-360deg);
  }
}
</style>
